package pl.edu.uj.tcs.blef.utils;

import java.util.LinkedList;

public class Hand {
	private LinkedList<Card> cards;
	private int handSize;
	
	public Hand(){
		this.cards = new LinkedList<Card>();
		this.handSize = 1;
	}
	
	public Hand(int i){
		this.cards = new LinkedList<Card>();
		this.handSize = i;
	}
	
	public void drawCards(Deck deck){
		for(int i=0; i<handSize; ++i){
			cards.add(deck.drawCard());
		}
	}

	public void setCards(LinkedList<Card> cards) {
		this.cards = cards;
	}

	public LinkedList<Card> getCards() {
		return cards;
	}

	public void incrementHandSize() {
		this.handSize++;
	}

	public int getHandSize() {
		return handSize;
	}
	
	@Override
	public String toString(){
		StringBuilder sb = new StringBuilder();
		sb.append("HAND-SIZE: " + handSize);
		sb.append('\n');
		for(Card c: cards){
			sb.append(c.getCode() + " " + c.getColor().getCode());
			sb.append('\n');
		}
		
		return sb.toString().trim();
	}
}
